<!--
 * Description: FD 行数据修改
 * Company: 联宝（合肥）电子科技有限公司
 * Author: Qiuxue.Wu
 * Date: 2020/06/11 09:30
-->

<template>
  <div>
    <!--数据表单-->
    <el-form label-width="200px" :model="formData" size="mini">
      <el-row>
        <el-col
          :span="24"
          style="background: #c9d2ca; text-align: left; padding: 5px; margin-bottom: 5px"
        >
          HEAD
        </el-col>
      </el-row>
      <el-row>
        <!--FDId-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.fdId')">
            <el-input v-model="formData.fdId" v-blur:fdId="formData" clearable disabled />
          </el-form-item>
        </el-col>
        <!--Row NO-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.version')">
            <el-input v-model="formData.version" v-blur:version="formData" clearable disabled />
          </el-form-item>
        </el-col>
        <!--Row NO-->
        <el-col :span="8">
          <el-form-item label="Row NO">
            <el-input v-model="formData.rowNo" v-blur:rowNo="formData" clearable disabled />
          </el-form-item>
        </el-col>

        <!--rd功能分类 EE/ME 等等-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.rdFunction')">
            <el-input v-model="formData.rdFunction" v-blur:rdFunction="formData" clearable />
          </el-form-item>
        </el-col>

        <!--类别-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.category')">
            <el-select
              v-model="formData.category"
              clearable
              filterable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['category/getCategoryCollects']"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <!--行号-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.itemNo')">
            <el-input-number
              v-model="formData.itemNo"
              v-blur:itemNo="formData"
              controls-position="right"
              :min="1"
            />
          </el-form-item>
        </el-col>

        <!--rd负责人（记录上传用户域名）-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.rdOwner')">
            <el-input v-model="formData.rdOwner" v-blur:rdOwner="formData" clearable />
          </el-form-item>
        </el-col>

        <!--Tracking-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.trackingOption')">
            <el-input
              v-model="formData.trackingOption"
              v-blur:trackingOption="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!-- optionType -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.optionType')">
            <el-input v-model="formData.optionType" v-blur:optionType="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base & new 的partNo是否一致可选值 [Different、Same]；当为Different时，gap_type和gap_cause必填。-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.statusCompare')">
            <el-input v-model="formData.statusCompare" v-blur:statusCompare="formData" clearable />
          </el-form-item>
        </el-col>

        <!--差距类型-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.gapType')">
            <el-input v-model="formData.gapType" v-blur:gapType="formData" clearable />
          </el-form-item>
        </el-col>

        <!--差距原因-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.gapReason')">
            <el-input v-model="formData.gapReason" v-blur:gapReason="formData" clearable />
          </el-form-item>
        </el-col>

        <!--GCM Function-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.gcmFunction')">
            <el-select
              v-model="formData.gcmFunction"
              clearable
              filterable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['enums/getGcmFunctionListOnly']"
                :key="item"
                :label="item"
                :value="item"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <!--commodity采购分类-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.commodity')">
            <el-select
              v-model="formData.commodity"
              clearable
              filterable
              :placeholder="$t('select.placeholder')"
              size="mini"
              style="width: 100%"
            >
              <el-option
                v-for="item in $store.getters['commodity/getCommodityCollectsByGcmFunction'](
                  formData.gcmFunction
                )"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              >
                <span style="float: left">{{ item.name }}</span>
                <span style="float: right; color: #b4b4b4; font-size: 12px">
                  {{ item.gcmFunction }}
                </span>
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!--GCM Owner-->
        <el-col :span="8">
          <!-- <el-form-item :label="$t('FdData.gcmOwner')">
            <span v-if="formData.gcmOwner">
              {{ $store.getters['user/getUserNameById'](formData.gcmOwner) || $t('result.none') }}
            </span>
          </el-form-item> -->
          <el-form-item :label="$t('FdData.gcmOwner')">
            <el-select
              v-model="formData.gcmOwner[0]"
              clearable
              filterable
              :placeholder="$t('FdData.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['user/getGcmUserSimpleCollects']"
                :key="item.userId"
                :label="item.userName"
                :value="item.userId"
              >
                <span style="float: left">{{ item.userName }}</span>
                <span style="float: right; color: #b4b4b4; font-size: 12px">
                  {{ item.gcmFunction + ' ' + item.team }}
                </span>
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!-- gcmTotalCostDelta -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.gcmTotalCostDelta')">
            <BaseInput
              v-model="formData.gcmTotalCostDelta"
              :max="9999999999.99999999"
              :precision="7"
            />
          </el-form-item>
        </el-col>

        <!-- GCM Cost Remark -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.gcmCostRemark')">
            <el-input v-model="formData.gcmCostRemark" v-blur:gcmCostRemark="formData" clearable />
          </el-form-item>
        </el-col>

        <!-- GCM估价状态 -->
        <el-col :span="8">
          <el-form-item label="GCM估价状态">
            <el-select
              v-model="formData.isGcmCost"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <!-- GCM估价时间 -->
        <el-col :span="8">
          <el-form-item label="GCM估价时间">
            <el-date-picker
              v-model="formData.gcmCostTime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </el-form-item>
        </el-col>

        <!-- GCM驳回状态 -->
        <el-col :span="8">
          <el-form-item label="GCM驳回状态">
            <el-select
              v-model="formData.isGcmReject"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <!-- GCM认领状态 -->
        <el-col :span="8">
          <el-form-item label="GCM认领状态">
            <el-select
              v-model="formData.isGcmClaim"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <!-- GCM提交状态 -->
        <el-col :span="8">
          <el-form-item label="GCM提交状态">
            <el-select
              v-model="formData.isGcmCommit"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <!-- pbmCommitCost -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.pbmCommitCost')">
            <el-input
              v-model="formData.pbmCommitCost"
              v-blur:pbmCommitCost="formData"
              clearable
              type="number"
            />
          </el-form-item>
        </el-col>
        <!-- pbmTotalCostDelta -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.pbmTotalCostDelta')">
            <el-input
              v-model="formData.pbmTotalCostDelta"
              v-blur:pbmTotalCostDelta="formData"
              clearable
              type="number"
            />
          </el-form-item>
        </el-col>
        <!-- pbmCommitTotalCostDelta -->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.pbmCommitTotalCostDelta')">
            <el-input
              v-model="formData.pbmCommitTotalCostDelta"
              v-blur:pbmCommitTotalCostDelta="formData"
              clearable
              type="number"
            />
          </el-form-item>
        </el-col>

        <!-- 创建时间 -->
        <el-col :span="8">
          <el-form-item label="创建时间">
            <el-date-picker
              v-model="formData.createTime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </el-form-item>
        </el-col>
        <!-- 分配时间 -->
        <el-col :span="8">
          <el-form-item label="分配时间">
            <el-date-picker
              v-model="formData.assignedTime"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </el-form-item>
        </el-col>
        <!-- 分配状态 -->
        <el-col :span="8">
          <el-form-item label="分配状态">
            <el-select
              v-model="formData.isGcmCost"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col
          :span="24"
          style="background: #c9d2ca; text-align: left; padding: 5px; margin-bottom: 5px"
        >
          {{ $t('FdData.baseProject') }}
        </el-col>
      </el-row>

      <el-row>
        <!--base-物料名称（物料的标准称呼）-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.basePartName')">
            <el-input v-model="formData.basePartName" v-blur:basePartName="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base-物料号-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.basePartNo')">
            <el-input v-model="formData.basePartNo" v-blur:basePartNo="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base-MaterialGroup-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.MaterialGroup')">
            <el-input
              v-model="formData.baseMaterialGroup"
              v-blur:baseMaterialGroup="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--baseMaterialDetail-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.MaterialDetail')">
            <el-input
              v-model="formData.baseMaterialDetail"
              v-blur:baseMaterialDetail="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--base-材料颜色-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseMaterialColor')">
            <el-input
              v-model="formData.baseMaterialColor"
              v-blur:baseMaterialColor="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--base-尺寸规格-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseSize')">
            <el-input v-model="formData.baseSize" v-blur:baseSize="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base-数量-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseQty')">
            <el-input-number v-model="formData.baseQty" controls-position="right" />
          </el-form-item>
        </el-col>

        <!--base-工艺-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseIdProcess')">
            <el-input v-model="formData.baseIdProcess" v-blur:baseIdProcess="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base-供应商-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseSupplier')">
            <el-input v-model="formData.baseSupplier" v-blur:baseSupplier="formData" clearable />
          </el-form-item>
        </el-col>

        <!--base-供应商PN-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseSupplierPn')">
            <el-input
              v-model="formData.baseSupplierPn"
              v-blur:baseSupplierPn="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--base-备注-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseRemark')">
            <el-input v-model="formData.baseRemark" v-blur:baseRemark="formData" clearable />
          </el-form-item>
        </el-col>

        <!--SAP标准价-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseSapStandardPrice')">
            <el-input
              v-model="formData.baseSapStandardPrice"
              v-blur:baseSapStandardPrice="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--SAP采购价-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseSapPurchasePrice')">
            <el-input
              v-model="formData.baseSapPurchasePrice"
              v-blur:baseSapPurchasePrice="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--basePrice-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.basePrice')">
            <el-input v-model="formData.basePrice" v-blur:basePrice="formData" clearable />
          </el-form-item>
        </el-col>
        <!--baseTecCost-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseTecCost')">
            <el-input v-model="formData.baseTecCost" v-blur:baseTecCost="formData" clearable />
          </el-form-item>
        </el-col>
        <!--basePartDesc-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.basePartDesc')">
            <el-input v-model="formData.basePartDesc" v-blur:basePartDesc="formData" clearable />
          </el-form-item>
        </el-col>
        <!--baseMaterialType-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.baseMaterialType')">
            <el-input
              v-model="formData.baseMaterialType"
              v-blur:baseMaterialType="formData"
              clearable
            />
          </el-form-item>
        </el-col>
        <!--TODO:basePicture-->
        <el-col :span="7">
          <el-form-item label="BasePicture">
            <el-input v-model="formData.basePicture" v-blur:basePicture="formData" clearable />
          </el-form-item>
        </el-col>
        <el-col :span="1">
          <el-link :style="styleLink" :underline="false" @click="newPictureEditClick(false)">
            详细
          </el-link>
        </el-col>
      </el-row>

      <el-row>
        <el-col
          :span="24"
          style="background: #c9d2ca; text-align: left; padding: 5px; margin-bottom: 5px"
        >
          {{ $t('FdData.newProject') }}
        </el-col>
      </el-row>

      <el-row>
        <!--new-物料名称（物料的标准称呼）-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newPartName')">
            <el-input v-model="formData.newPartName" v-blur:newPartName="formData" clearable />
          </el-form-item>
        </el-col>

        <!--new-物料号-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newPartNo')">
            <el-input v-model="formData.newPartNo" v-blur:newPartNo="formData" clearable />
          </el-form-item>
        </el-col>

        <!--newMaterialGroup-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.MaterialGroup')">
            <el-input
              v-model="formData.newMaterialGroup"
              v-blur:newMaterialGroup="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--newMaterialDetail-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.MaterialDetail')">
            <el-input
              v-model="formData.newMaterialDetail"
              v-blur:newMaterialDetail="formData"
              clearable
            />
            <!-- <el-select
              v-model="formData.newMaterialType"
              clearable
              filterable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['material/getMaterialCollects']"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              />
            </el-select> -->
          </el-form-item>
        </el-col>

        <!--base-材料颜色-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newMaterialColor')">
            <el-input
              v-model="formData.newMaterialColor"
              v-blur:newMaterialColor="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--new-尺寸规格-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newSize')">
            <el-input v-model="formData.newSize" v-blur:newSize="formData" clearable />
          </el-form-item>
        </el-col>

        <!--new-数量-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newQty')">
            <el-input-number v-model="formData.newQty" controls-position="right" />
          </el-form-item>
        </el-col>

        <!--new-工艺-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newIdProcess')">
            <el-input v-model="formData.newIdProcess" v-blur:newIdProcess="formData" clearable />
          </el-form-item>
        </el-col>

        <!--new-供应商-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newSupplier')">
            <el-input v-model="formData.newSupplier" v-blur:newSupplier="formData" clearable />
          </el-form-item>
        </el-col>

        <!--new-供应商PN-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newSupplierPn')">
            <el-input v-model="formData.newSupplierPn" v-blur:newSupplierPn="formData" clearable />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <!--new-临时物料号-->
          <el-form-item :label="$t('FdData.newTempPartNo')">
            <el-input v-model="formData.newTempPartNo" v-blur:newTempPartNo="formData" clearable />
          </el-form-item>
        </el-col>

        <!--new-是否新料-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newTooling')">
            <el-select
              v-model="formData.newTooling"
              clearable
              :placeholder="$t('select.placeholder')"
            >
              <el-option
                v-for="item in $store.getters['dict/dictOptions']('YN')"
                :key="item.code"
                :label="item.value"
                :value="item.code"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <!--newPrice-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newPrice')">
            <el-input v-model="formData.newPrice" v-blur:newPrice="formData" clearable />
          </el-form-item>
        </el-col>
        <!--newTecCost-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newTecCost')">
            <el-input v-model="formData.newTecCost" v-blur:newTecCost="formData" clearable />
          </el-form-item>
        </el-col>

        <!--SAP标准价-->
        <el-col :span="8">
          <el-form-item label="SAP标准价">
            <el-input
              v-model="formData.newSapStandardPrice"
              v-blur:newSapStandardPrice="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--SAP采购价-->
        <el-col :span="8">
          <el-form-item label="SAP采购价">
            <el-input
              v-model="formData.newSapPurchasePrice"
              v-blur:newSapPurchasePrice="formData"
              clearable
            />
          </el-form-item>
        </el-col>

        <!--new-备注-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newRemark')">
            <el-input v-model="formData.newRemark" v-blur:newRemark="formData" clearable />
          </el-form-item>
        </el-col>
        <!--newPartDesc-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newPartDesc')">
            <el-input v-model="formData.newPartDesc" v-blur:newPartDesc="formData" clearable />
          </el-form-item>
        </el-col>
        <!--newMaterialType-->
        <el-col :span="8">
          <el-form-item :label="$t('FdData.newMaterialType')">
            <el-input
              v-model="formData.newMaterialType"
              v-blur:newMaterialType="formData"
              clearable
            />
          </el-form-item>
        </el-col>
        <!--newPicture-->
        <el-col :span="7">
          <el-form-item label="NewPicture">
            <el-input v-model="formData.newPicture" v-blur:newPicture="formData" clearable />
          </el-form-item>
        </el-col>

        <el-col :span="1">
          <el-link :style="styleLink" :underline="false" @click="newPictureEditClick(true)">
            详细
          </el-link>
        </el-col>
        <el-col :span="8">
          <el-form-item>
            <el-link :style="styleLink" :underline="false" @click="costModelClick()">
              成本模型计算结果
            </el-link>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span style="display: block; text-align: center; margin-top: 5px">
      <!--取消按钮-->
      <el-button size="medium" @click="cancel">{{ $t('button.cancel') }}</el-button>
      <!--保存按钮-->
      <el-button :loading="isRequesting" size="medium" type="primary" @click="save">
        {{ $t('button.save') }}
      </el-button>
    </span>
    <!--详细对话框-->
    <BaseDialog
      v-if="pictureDialogVisible"
      :title="$t('button.edit')"
      :visible.sync="pictureDialogVisible"
      width="600px"
    >
      <FdEditPictureEdit
        :fd-row-id="fdRowId"
        :is-new="isNew"
        @cancel="pictureDialogVisible = false"
      />
    </BaseDialog>
    <!--成本模型对话框-->
    <BaseDialog
      v-if="costModelDialogVisible"
      :title="$t('button.edit')"
      :visible.sync="costModelDialogVisible"
      width="600px"
    >
      <FdEditCostModel :fd-row-id="fdRowId" @cancel="costModelDialogVisible = false" />
    </BaseDialog>
  </div>
</template>

<script>
import { fdRowEditPart } from '@/api/quote/fd-row'
import FdEditPictureEdit from './FdEditPictureEdit'
import FdEditCostModel from './FdEditCostModel'

export default {
  name: 'FdDetailEditEdit',
  components: { FdEditPictureEdit, FdEditCostModel },
  props: {
    inputData: {
      type: Object,
      default: () => {}
    },
    fdBaseData: {
      type: Object,
      default: () => null
    }
  },
  data() {
    return {
      // 正在查询
      isRequesting: false,
      formData: {
        gcmOwner: []
      },
      // picture 详细查询的样式
      styleLink: {
        color: '#409EFF',
        fontSize: '16px',
        lineHeight: '30px',
        height: '30px'
      },
      // 图片查询编辑对话框可见参数
      pictureDialogVisible: false,
      // 成本模型对话框可见参数
      costModelDialogVisible: false,
      // 对话框查询所需要的参数
      fdRowId: '',
      isNew: true
    }
  },
  mounted() {
    this.pageDataInit()
  },
  methods: {
    pageDataInit() {
      this.formData = this.$deepCopy(this.inputData)
      this.fdRowId = this.$deepCopy(this.inputData.fdRowId)
      if (this.formData.gcmOwner === null) {
        this.formData.gcmOwner = []
      }

      this.$store.dispatch('category/initCategoryCollectsLazy')
      this.$store.dispatch('material/initMaterialCollectsLazy')
      this.$store.dispatch('commodity/initCommodityCollectsLazy')
    },
    async save() {
      try {
        await this.$confirmBox(this.$t('button.save'), 'success')
        this.isRequesting = true
        if (this.formData.gcmOwner.length < 1) {
          this.formData.gcmOwner = null
        }
        await fdRowEditPart(this.formData, { msgSuccess: true, msgError: true })
        this.$emit('save', this.formData)
      } catch (error) {
        console.log(error)
      } finally {
        this.isRequesting = false
      }
    },
    cancel() {
      this.$emit('cancel')
    },
    newPictureEditClick(boolean) {
      this.pictureDialogVisible = true
      this.isNew = boolean
    },
    costModelClick() {
      this.costModelDialogVisible = true
    }
  }
}
</script>
